﻿using UnityEngine;

public abstract class BaseUI : MonoBehaviour
{
    public virtual void Init(params object[] args)
    {
        OnInit(args);
    }

    public virtual void Dispose()
    {
        OnDispose();
    }

    public virtual void Open(params object[] args)
    {
        gameObject.SetActive(true);
        OnOpen(args);
    }

    public virtual void Close()
    {
        gameObject.SetActive(false);
        OnClose();
    }

    protected abstract void OnInit(params object[] args);
    protected abstract void OnDispose();
    protected abstract void OnOpen(params object[] args);
    protected abstract void OnClose();

    void Awake()
    {
        Init();
    }
}
